package com.shanzmoo.db.sys.entity.vo;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.stm.entity.StmSysMenuEntity;
import com.shanzmoo.db.sys.entity.MenuEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 *
 * @author Gzhao
 * @date 2020/11/16
 */
@Data
@ApiModel("菜单树对象")
public class MenuTreeVo {

    @ApiModelProperty("菜单Id" )
    private Integer menuId;

    @ApiModelProperty("菜单名称" )
    private String menuName;

    @ApiModelProperty("子菜单" )
    private List<MenuTreeVo> children;

    public static MenuTreeVo create(MenuEntity menuEntity) {
        return JSON.parseObject(JSON.toJSONString(menuEntity), MenuTreeVo.class);
    }

    public static MenuTreeVo create(StmSysMenuEntity menuEntity) {
        return JSON.parseObject(JSON.toJSONString(menuEntity), MenuTreeVo.class);
    }
}
